"""bug_platform URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from web.views import project, statistics, wiki, file, setting, issues, dashboard

from web.views import account

urlpatterns = [
    path('admin/', admin.site.urls),

    path('', include(('web.urls', "web"))),
    path('app01/', include(('app01.urls', "app01"))),

    path('project/list/', project.project_list, name='project_list'),

    path('project/unstar/<project_type>/<project_id>)/', project.project_unstar, name='project_unstar'),

    path('project/star/<project_type>/<project_id>)/', project.project_star, name='project_star'),

    # 进入项目管理
    # path('manage/(?P<project_id>\d+)\/dashboard/', manage.dashboard, name='dashboard'),

    # 问题
    path('manage/<project_id>/issues/', issues.issues, name='issues'),  # 列表
    path('manage/<project_id>/issues/invite/url/', issues.invite_url, name='invite_url'),  # 邀请成员的ajax
    path('manage/<project_id>/issues/detail/<issues_id>/', issues.issues_detail, name='issues_detail'),  # 编辑问题
    path('manage/<project_id>/issues/record/<issues_id>/', issues.issues_record, name='issues_record'),  # 编辑问题初始化的ajax
    path('manage/<project_id>/issues/change/<issues_id>/', issues.issues_change, name='issues_change'),  # 编辑问题发送的ajax马上修改并更新数据库

    # 邀请码不能带manage 如果带了就有中间件限制不能访问【被邀请者还不是当前项目成员 没有账户密码登录不了
    # 项目成员
    path('invite/join/<code>/', issues.invite_join, name='invite_join'),

    # 文档管理
    path('manage/<project_id>/wiki/', wiki.wiki, name='wiki'),
    path('manage/<project_id>/wiki/add/', wiki.wiki_add, name='wiki_add'),  # 新建
    path('manage/<project_id>/wiki/delete/<wiki_id>', wiki.wiki_delete, name='wiki_delete'),  # 删除
    path('manage/<project_id>/wiki/edit/<wiki_id>', wiki.wiki_edit, name='wiki_edit'),  # 编辑
    path('manage/<project_id>/wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),  # 目录
    path('manage/<project_id>/wiki/upload/', wiki.wiki_upload, name='wiki_upload'),  # 上传图片
    # path('manage/<project_id>/wiki/detail/', wiki.wiki_detail, name='wiki_detail'),

    # 文件管理
    path('manage/<project_id>/file/', file.file, name='file'),
    # 文件删除
    path('manage/<project_id>/file/delete/', file.file_delete, name='file_delete'),
    # cos临时
    path('manage/<project_id>/cos/credential/', file.cos_credential, name='cos_credential'),
    # 文件上传成功后返回到后台 将数据保存到数据库
    path('manage/<project_id>/file/post/', file.file_post, name='file_post'),
    # 文件下载
    path('manage/<project_id>/file/download/<file_id>', file.file_download, name='file_download'),

    # 设置
    path('manage/<project_id>/setting/', setting.setting, name='setting'),
    # 删除项目
    path('manage/<project_id>/setting/delete/', setting.setting_delete, name='setting_delete'),

    # 概览
    path('manage/<project_id>/dashboard/', dashboard.dashboard, name='dashboard'),
    path('manage/<project_id>/dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),  # 问题趋势ajax

    # 统计
    path('manage/<project_id>/statistics/', statistics.statistics, name='statistics'),
    # path('send/register/', send.register),
    # path('app01/', include(('app01.urls', 'app01'), namespace='app01')),
    # path('web/', include(('web.urls', 'web'), namespace='web')),
    # path(r'^web/', include(('web', 'web.urls'), namespace='web')),
    # 登录
    # path('register/', account.register),  # "register"
    # ajax请求
    # path('send/sms/', account.send_sms),  # "register"

]
